package com.bbva.kyfb.kyfbjpatlbh.dominiotlbh;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

/**
 * The Class Ttlsbcor.
 */
@Configurable
@Entity
@Table(name = "TTLSBCOR",schema = "TLSB")
@RooJavaBean
@RooToString
@RooEntity(identifierType = TtlsbcorPK.class, versionField = "",  persistenceUnit="persistenceUnitTLBH",table = "TTLSBCOR", schema = "TLSB")
@PersistenceContext(unitName="persistenceUnitTLBH")
@RooDbManaged(automaticallyDelete = true)
public class Ttlsbcor {

	/** The cod cdnitr. */
	@Column(name = "COD_CDNITR",columnDefinition = "CHAR", length = 10)
    @NotNull
    private String codCdnitr;

	/** The cod sufprese. */
	@Column(name = "COD_SUFPRESE",columnDefinition = "CHAR", length = 3)
    @NotNull
    private String codSufprese;

	/** The cod idorigen. */
	@Column(name = "COD_IDORIGEN",columnDefinition = "CHAR", length = 15)
    private String codIdorigen;

	/** The des cuenorig. */
	@Column(name = "DES_CUENORIG",columnDefinition = "CHAR", length = 35)
    private String desCuenorig;

	/** The aud fmodific. */
	@Column(name = "AUD_FMODIFIC", columnDefinition = "DATE")
    @NotNull
    @Temporal(TemporalType.DATE)
    @DateTimeFormat(style = "M-")
    private Date audFmodific;

	/** The aud usuario. */
	@Column(name = "AUD_USUARIO",columnDefinition = "CHAR", length = 8)
    @NotNull
    private String audUsuario;

	/** The cod bancinte. */
	@Column(name = "COD_BANCINTE",columnDefinition = "CHAR", length = 11)
    private String codBancinte;

	/** The cod swift. */
	@Column(name = "COD_SWIFT",columnDefinition = "CHAR", length = 11)
    private String codSwift;

	/** The des fecprocr. */
	@Column(name = "DES_FECPROCR",columnDefinition = "CHAR", length = 8)
    private String desFecprocr;

	/** The cod paisdfis. */
	@Column(name = "COD_PAISDFIS",columnDefinition = "CHAR", length = 2)
    private String codPaisdfis;

	/** The cod cestad. */
	@Column(name = "COD_CESTAD",columnDefinition = "CHAR", length = 11)
    private String codCestad;

	/** The cod paiscta. */
	@Column(name = "COD_PAISCTA",columnDefinition = "CHAR", length = 2)
    private String codPaiscta;

	/** The cod paiscob. */
	@Column(name = "COD_PAISCOB",columnDefinition = "CHAR", length = 2)
    private String codPaiscob;

	/** The cod prodcnf. */
	@Column(name = "COD_PRODCNF",columnDefinition = "DECIMAL")
    private BigDecimal codProdcnf;

	/** The xti nifid. */
	@Column(name = "XTI_NIFID",columnDefinition = "CHAR",length=1)
    private Character xtiNifid;

	/** The cod clasemis. */
	@Column(name = "COD_CLASEMIS",columnDefinition = "CHAR", length = 3)
    private String codClasemis;

	/** The des numremes. */
	@Column(name = "DES_NUMREMES",columnDefinition = "CHAR", length = 15)
    @NotNull
    private String desNumremes;

	/** The des reflote. */
	@Column(name = "DES_REFLOTE",columnDefinition = "CHAR", length = 40)
    private String desReflote;

	/** The cod sitlote. */
	@Column(name = "COD_SITLOTE",columnDefinition = "CHAR", length = 4)
    private String codSitlote;

	/** The xsn contabix. */
	@Column(name = "XSN_CONTABIX",columnDefinition = "DECIMAL")
    private BigDecimal xsnContabix;

	/** The des extractx. */
	@Column(name = "DES_EXTRACTX",columnDefinition = "CHAR", length = 20)
    private String desExtractx;

	/**
	 * Gets the cod cdnitr.
	 *
	 * @return the cod cdnitr
	 */
	public String getCodCdnitr() {
        return this.codCdnitr;
    }

	/**
	 * Sets the cod cdnitr.
	 *
	 * @param codCdnitr the new cod cdnitr
	 */
	public void setCodCdnitr(String codCdnitr) {
        this.codCdnitr = codCdnitr;
    }

	/**
	 * Gets the cod sufprese.
	 *
	 * @return the cod sufprese
	 */
	public String getCodSufprese() {
        return this.codSufprese;
    }

	/**
	 * Sets the cod sufprese.
	 *
	 * @param codSufprese the new cod sufprese
	 */
	public void setCodSufprese(String codSufprese) {
        this.codSufprese = codSufprese;
    }

	/**
	 * Gets the cod idorigen.
	 *
	 * @return the cod idorigen
	 */
	public String getCodIdorigen() {
        return this.codIdorigen;
    }

	/**
	 * Sets the cod idorigen.
	 *
	 * @param codIdorigen the new cod idorigen
	 */
	public void setCodIdorigen(String codIdorigen) {
        this.codIdorigen = codIdorigen;
    }

	/**
	 * Gets the des cuenorig.
	 *
	 * @return the des cuenorig
	 */
	public String getDesCuenorig() {
        return this.desCuenorig;
    }

	/**
	 * Sets the des cuenorig.
	 *
	 * @param desCuenorig the new des cuenorig
	 */
	public void setDesCuenorig(String desCuenorig) {
        this.desCuenorig = desCuenorig;
    }

	/**
	 * Gets the aud fmodific.
	 *
	 * @return the aud fmodific
	 */
	public Date getAudFmodific() {
        return this.audFmodific;
    }

	/**
	 * Sets the aud fmodific.
	 *
	 * @param audFmodific the new aud fmodific
	 */
	public void setAudFmodific(Date audFmodific) {
        this.audFmodific = audFmodific;
    }

	/**
	 * Gets the aud usuario.
	 *
	 * @return the aud usuario
	 */
	public String getAudUsuario() {
        return this.audUsuario;
    }

	/**
	 * Sets the aud usuario.
	 *
	 * @param audUsuario the new aud usuario
	 */
	public void setAudUsuario(String audUsuario) {
        this.audUsuario = audUsuario;
    }

	/**
	 * Gets the cod bancinte.
	 *
	 * @return the cod bancinte
	 */
	public String getCodBancinte() {
        return this.codBancinte;
    }

	/**
	 * Sets the cod bancinte.
	 *
	 * @param codBancinte the new cod bancinte
	 */
	public void setCodBancinte(String codBancinte) {
        this.codBancinte = codBancinte;
    }

	/**
	 * Gets the cod swift.
	 *
	 * @return the cod swift
	 */
	public String getCodSwift() {
        return this.codSwift;
    }

	/**
	 * Sets the cod swift.
	 *
	 * @param codSwift the new cod swift
	 */
	public void setCodSwift(String codSwift) {
        this.codSwift = codSwift;
    }

	/**
	 * Gets the des fecprocr.
	 *
	 * @return the des fecprocr
	 */
	public String getDesFecprocr() {
        return this.desFecprocr;
    }

	/**
	 * Sets the des fecprocr.
	 *
	 * @param desFecprocr the new des fecprocr
	 */
	public void setDesFecprocr(String desFecprocr) {
        this.desFecprocr = desFecprocr;
    }

	/**
	 * Gets the cod paisdfis.
	 *
	 * @return the cod paisdfis
	 */
	public String getCodPaisdfis() {
        return this.codPaisdfis;
    }

	/**
	 * Sets the cod paisdfis.
	 *
	 * @param codPaisdfis the new cod paisdfis
	 */
	public void setCodPaisdfis(String codPaisdfis) {
        this.codPaisdfis = codPaisdfis;
    }

	/**
	 * Gets the cod cestad.
	 *
	 * @return the cod cestad
	 */
	public String getCodCestad() {
        return this.codCestad;
    }

	/**
	 * Sets the cod cestad.
	 *
	 * @param codCestad the new cod cestad
	 */
	public void setCodCestad(String codCestad) {
        this.codCestad = codCestad;
    }

	/**
	 * Gets the cod paiscta.
	 *
	 * @return the cod paiscta
	 */
	public String getCodPaiscta() {
        return this.codPaiscta;
    }

	/**
	 * Sets the cod paiscta.
	 *
	 * @param codPaiscta the new cod paiscta
	 */
	public void setCodPaiscta(String codPaiscta) {
        this.codPaiscta = codPaiscta;
    }

	/**
	 * Gets the cod paiscob.
	 *
	 * @return the cod paiscob
	 */
	public String getCodPaiscob() {
        return this.codPaiscob;
    }

	/**
	 * Sets the cod paiscob.
	 *
	 * @param codPaiscob the new cod paiscob
	 */
	public void setCodPaiscob(String codPaiscob) {
        this.codPaiscob = codPaiscob;
    }

	/**
	 * Gets the cod prodcnf.
	 *
	 * @return the cod prodcnf
	 */
	public BigDecimal getCodProdcnf() {
        return this.codProdcnf;
    }

	/**
	 * Sets the cod prodcnf.
	 *
	 * @param codProdcnf the new cod prodcnf
	 */
	public void setCodProdcnf(BigDecimal codProdcnf) {
        this.codProdcnf = codProdcnf;
    }

	/**
	 * Gets the xti nifid.
	 *
	 * @return the xti nifid
	 */
	public Character getXtiNifid() {
        return this.xtiNifid;
    }

	/**
	 * Sets the xti nifid.
	 *
	 * @param xtiNifid the new xti nifid
	 */
	public void setXtiNifid(Character xtiNifid) {
        this.xtiNifid = xtiNifid;
    }

	/**
	 * Gets the cod clasemis.
	 *
	 * @return the cod clasemis
	 */
	public String getCodClasemis() {
        return this.codClasemis;
    }

	/**
	 * Sets the cod clasemis.
	 *
	 * @param codClasemis the new cod clasemis
	 */
	public void setCodClasemis(String codClasemis) {
        this.codClasemis = codClasemis;
    }

	/**
	 * Gets the des numremes.
	 *
	 * @return the des numremes
	 */
	public String getDesNumremes() {
        return this.desNumremes;
    }

	/**
	 * Sets the des numremes.
	 *
	 * @param desNumremes the new des numremes
	 */
	public void setDesNumremes(String desNumremes) {
        this.desNumremes = desNumremes;
    }

	/**
	 * Gets the des reflote.
	 *
	 * @return the des reflote
	 */
	public String getDesReflote() {
        return this.desReflote;
    }

	/**
	 * Sets the des reflote.
	 *
	 * @param desReflote the new des reflote
	 */
	public void setDesReflote(String desReflote) {
        this.desReflote = desReflote;
    }

	/**
	 * Gets the cod sitlote.
	 *
	 * @return the cod sitlote
	 */
	public String getCodSitlote() {
        return this.codSitlote;
    }

	/**
	 * Sets the cod sitlote.
	 *
	 * @param codSitlote the new cod sitlote
	 */
	public void setCodSitlote(String codSitlote) {
        this.codSitlote = codSitlote;
    }

	/**
	 * Gets the xsn contabix.
	 *
	 * @return the xsn contabix
	 */
	public BigDecimal getXsnContabix() {
        return this.xsnContabix;
    }

	/**
	 * Sets the xsn contabix.
	 *
	 * @param xsnContabix the new xsn contabix
	 */
	public void setXsnContabix(BigDecimal xsnContabix) {
        this.xsnContabix = xsnContabix;
    }

	/**
	 * Gets the des extractx.
	 *
	 * @return the des extractx
	 */
	public String getDesExtractx() {
        return this.desExtractx;
    }

	/**
	 * Sets the des extractx.
	 *
	 * @param desExtractx the new des extractx
	 */
	public void setDesExtractx(String desExtractx) {
        this.desExtractx = desExtractx;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("AudFmodific: ").append(getAudFmodific()).append(", ");
        sb.append("AudUsuario: ").append(getAudUsuario()).append(", ");
        sb.append("CodBancinte: ").append(getCodBancinte()).append(", ");
        sb.append("CodCdnitr: ").append(getCodCdnitr()).append(", ");
        sb.append("CodCestad: ").append(getCodCestad()).append(", ");
        sb.append("CodClasemis: ").append(getCodClasemis()).append(", ");
        sb.append("CodIdorigen: ").append(getCodIdorigen()).append(", ");
        sb.append("CodPaiscob: ").append(getCodPaiscob()).append(", ");
        sb.append("CodPaiscta: ").append(getCodPaiscta()).append(", ");
        sb.append("CodPaisdfis: ").append(getCodPaisdfis()).append(", ");
        sb.append("CodProdcnf: ").append(getCodProdcnf()).append(", ");
        sb.append("CodSitlote: ").append(getCodSitlote()).append(", ");
        sb.append("CodSufprese: ").append(getCodSufprese()).append(", ");
        sb.append("CodSwift: ").append(getCodSwift()).append(", ");
        sb.append("DesCuenorig: ").append(getDesCuenorig()).append(", ");
        sb.append("DesExtractx: ").append(getDesExtractx()).append(", ");
        sb.append("DesFecprocr: ").append(getDesFecprocr()).append(", ");
        sb.append("DesNumremes: ").append(getDesNumremes()).append(", ");
        sb.append("DesReflote: ").append(getDesReflote()).append(", ");
        sb.append("Id: ").append(getId()).append(", ");
        sb.append("XsnContabix: ").append(getXsnContabix()).append(", ");
        sb.append("XtiNifid: ").append(getXtiNifid());
        return sb.toString();
    }

	/** The entity manager. */
	@PersistenceContext(unitName="persistenceUnitTLBH")
    transient EntityManager entityManager;

	/** The id. */
	@EmbeddedId
    private TtlsbcorPK id;

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public TtlsbcorPK getId() {
        return this.id;
    }

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(TtlsbcorPK id) {
        this.id = id;
    }

	/**
	 * Persist.
	 */
	@Transactional(value="tlbh")
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.persist(this);
    }

	/**
	 * Removes the.
	 */
	@Transactional(value="tlbh")
    public void remove() {
        if (this.entityManager == null) this.entityManager = entityManager();
        if (this.entityManager.contains(this)) {
            this.entityManager.remove(this);
        } else {
            Ttlsbcor attached = Ttlsbcor.findTtlsbcor(this.id);
            this.entityManager.remove(attached);
        }
    }

	/**
	 * Flush.
	 */
	@Transactional(value="tlbh")
    public void flush() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.flush();
    }

	/**
	 * Clear.
	 */
	@Transactional(value="tlbh")
    public void clear() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.clear();
    }

	/**
	 * Merge.
	 *
	 * @return the ttlsbcor
	 */
	@Transactional(value="tlbh")
    public Ttlsbcor merge() {
        if (this.entityManager == null) this.entityManager = entityManager();
        Ttlsbcor merged = this.entityManager.merge(this);
        this.entityManager.flush();
        return merged;
    }

	/**
	 * Entity manager.
	 *
	 * @return the entity manager
	 */
	public static final EntityManager entityManager() {
        EntityManager em = new Ttlsbcor().entityManager;
        if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
        return em;
    }

	
	/**
	 * Count ttlsbcors.
	 *
	 * @return the long
	 */
	@Transactional(value="tlbh")
	public static long countTtlsbcors() {
        return entityManager().createQuery("SELECT COUNT(o) FROM Ttlsbcor o", Long.class).getSingleResult();
    }

	
	/**
	 * Find all ttlsbcors.
	 *
	 * @return the list
	 */
	@Transactional(value="tlbh")
	public static List<Ttlsbcor> findAllTtlsbcors() {
        return entityManager().createQuery("SELECT o FROM Ttlsbcor o", Ttlsbcor.class).getResultList();
    }

	
	/**
	 * Find ttlsbcor.
	 *
	 * @param id the id
	 * @return the ttlsbcor
	 */
	@Transactional(value="tlbh")
	public static Ttlsbcor findTtlsbcor(TtlsbcorPK id) {
        if (id == null) return null;
        return entityManager().find(Ttlsbcor.class, id);
    }

	
	/**
	 * Find ttlsbcor entries.
	 *
	 * @param firstResult the first result
	 * @param maxResults the max results
	 * @return the list
	 */
	@Transactional(value="tlbh")
	public static List<Ttlsbcor> findTtlsbcorEntries(int firstResult, int maxResults) {
        return entityManager().createQuery("SELECT o FROM Ttlsbcor o", Ttlsbcor.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
    }
}
